package org.jkyec.lambda.basic;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.function.Function;

public class FunctionTest {

	public static void main(String[] args) {
		// plus 10
		Function<Integer, Integer> intFunction = (inputInt) -> { return inputInt + 10; };
		
		// result: 11
		System.out.println(intFunction.apply(1));
		
		// to upper case
		Function<String, String> stringFunction = (inputInt) -> { return inputInt.toUpperCase(); };
		
		// result: ABCD
		System.out.println(stringFunction.apply("abcd"));
		
		// amount to BigDecimal
		Function<Double, BigDecimal> numFunction = (amount) -> { return new BigDecimal(amount).setScale(2, RoundingMode.CEILING); };
		
		// result: 100.00
		System.out.println(numFunction.apply(100d));
		
	}

}
